<template>
  <div ref="print" style="width:100%; margin: 0 auto;" v-show="isPreview">
    <table>
      <tr>
        <td colspan="14" align="center" height="24" style="font-size: 24px;">特殊/半年度/年度对账函</td>
      </tr>
      <tr>
        <td colspan="7" align="left" height="26">截止日期：{{ data.createdAt }}&nbsp;</td>
        <td colspan="7" align="right" height="26">单位：元</td>
      </tr>
    </table>

    <table class="bor fs12 tc">
      <tr>
        <td width="10%" height="26">项目</td>
        <td>整车款余额</td>
        <td>整车返利余额</td>
        <td>备件款余额</td>
        <td>备件返利余额</td>
        <td>建店保证金余额</td>
        <td>其他类应收款项</td>
        <td>其他类应付款项</td>
        <td>对账结果</td>
      </tr>

      <tr>
        <td width="10%" height="26">主机厂金额</td>
        <td>{{ data.vehicleAccountAmount }}</td>
        <td>{{ data.vehicleRebateAmount }}</td>
        <td>{{ data.partAccountAmount }}</td>
        <td>{{ data.partRebateAmount }}</td>
        <td>{{ data.depositAmount }}</td>
        <td>{{ data.otherInAmount }}</td>
        <td>{{ data.otherOutAmount }}</td>
        <td></td>
      </tr>

      <tr>
        <td width="10%" height="26">差异金额</td>
        <td>{{ data.vehicleAccountDifferences }}</td>
        <td>{{ data.vehicleRebateDifferences }}</td>
        <td>{{ data.partAccountDifferences }}</td>
        <td>{{ data.partRebateDifferences }}</td>
        <td>{{ data.depositDifferences }}</td>
        <td>{{ data.otherInDifferences }}</td>
        <td>{{ data.otherOutDifferences }}</td>
        <td></td>
      </tr>

      <tr>
        <td width="10%" height="26">调整后金额</td>
        <td>{{ data.vehicleAccountAdjustment }}</td>
        <td>{{ data.vehicleRebateAdjustment }}</td>
        <td>{{ data.partAccountAdjustment }}</td>
        <td>{{ data.partRebateAdjustment }}</td>
        <td>{{ data.depositAdjustment }}</td>
        <td>{{ data.otherInAdjustment }}</td>
        <td>{{ data.otherOutAdjustment }}</td>
        <td>{{ data.verifyResult }}</td>
      </tr>

      <tr>
        <td width="10%" height="26">经销商反馈差异金额</td>
        <td colspan="8">{{ data.feedbackAmountDesc }}</td>
      </tr>
      <tr>
        <td width="10%" height="26">经销商反馈差异说明</td>
        <td colspan="8">{{ data.feedbackExplainDesc }}</td>
      </tr>
    </table>

    <table>
      <tr height="30">
        <td>主机厂公司名称</td>
        <td width="32%">经销商公司名称</td>
      </tr>
      <tr>
        <td>盖章</td>
        <td width="32%">盖章</td>
      </tr>
      <tr>
        <td>日期</td>
        <td width="32%">日期</td>
      </tr>
    </table>
  </div>
</template>

<script>
/**
 * @Author: 焦质晔
 * @Date: 2019/4/22
 * @Last Modified by:   焦质晔
 * @Last Modified time: 2019-04-22 15:45:09
 **/
import moment from 'moment';

export default {
  name: 'RebateStatementQuery',
  props: {
    data: {
      type: Object,
      required: true,
      default() {
        return {};
      }
    },
    isPreview: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      nowTime: moment().format('YYYY-MM-DD HH:mm:ss')
    };
  },
  computed: {
    // totalPrice() {
    //   return this.data.items.reduce((prev, curr) => {
    //     return curr.ckdj * curr.ckdj + prev;
    //   }, 0);
    // }
  },
  methods: {
    fillInToDom() {
      this.isPreview = true;
    }
  },
  mounted() {
    this.$emit('onPrintTable', this.$refs.print.innerHTML);
    if (this.isPreview) {
      this.fillInToDom();
    }
  }
};
</script>
